<div class="pruebas form">
    <?php echo $this->Form->create('Prueba', array('url' => array('controller' => 'pruebas', 'action' => 'grafico2'))); ?>
    <fieldset>
        <legend><?php __('Porcentajes de Tipos Vendidos'); ?></legend>
        <?php
        echo $this->Form->input('retoque', array('label' => 'Con retoque:', 'type' => 'select', 'options' => array('Si', 'No')));
        ?>
    </fieldset>
    <?php echo $this->Form->end(__('Generar', true)); ?>
    
    <table cellpadding="0" cellspacing="0">
        <tr>
            <th><?php echo("Tipo"); ?></th>
            <th><?php echo("Cantidad"); ?></th>
        </tr>
        <?php
        $i = 0;
        $total = 0;
        $array_datos = array();
        if ($mostrar_grafica == 1) {
            $array_datos = $datos;
        }
        foreach ($array_datos as $dato):
            $class = null;
            if ($i++ % 2 == 0) {
                $class = ' class="altrow"';
            }
                $total = $total + $dato[0]['suma'];
            ?>
            <tr<?php echo $class; ?>>
                <td><?php echo $dato['types']['tipo']; ?>&nbsp;</td>
                <td><?php echo $dato[0]['suma']; ?>&nbsp;</td>
            </tr>
        <?php endforeach; ?>
        <tr>
            <th><?php echo("Total"); ?></th>
            <th><?php echo $total; ?>&nbsp;</th>
        </tr>
    </table>
    <!--<?php echo $this->Form->end(__('Generar', true)); ?>-->

    <?php
    if ($mostrar_grafica == 1) {
        echo $html->image('grafico2.png');
    }
    ?>
</div>